package com.shanglv.web.common.directive;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

import com.shanglv.web.common.inteceptor.GlobalPropertiesConfigurer;

import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;


public class StaticDirective extends BaseDirective implements TemplateDirectiveModel{

	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
        String url = getParams(params, ATTR_URL);
        Writer out = env.getOut();
        out.write(GlobalPropertiesConfigurer.getProperties("staticResourcePath")+url);
    }
}
